/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package geometry.entity;

import geometry.IRoute;
import geometry.ILocation;
import geometry.IPlace;

import java.util.HashMap;

/**
 *
 * @author Administrator
 */
 class Route implements IRoute {

    private float Distance=0.0f;
    private HashMap<Integer, ILocation> Leg;
    private String Unit = "米";
    private IPlace Origin;
    private IPlace Destination;

    public Route() {
        Origin=new Place();
        Destination=new Place();
        Leg=new HashMap<Integer, ILocation>();
    }

    public Route(float Distance, HashMap<Integer, ILocation> Leg, IPlace Origin, IPlace Destination) {
        this.Distance = Distance;
        this.Leg = Leg;
        this.Origin = Origin;
        this.Destination = Destination;
    }

    /**
     * Get the value of Destination
     *
     * @return the value of Destination
     */
    @Override
    public IPlace getDestination() {
        return Destination;
    }

    /**
     * Set the value of Destination
     *
     * @param Destination new value of Destination
     */
    @Override
    public void setDestination(IPlace Destination) {
        this.Destination = Destination;
    }

    /**
     * Get the value of Origin
     *
     * @return the value of Origin
     */
    @Override
    public IPlace getOrigin() {
        return Origin;
    }

    /**
     * Set the value of Origin
     *
     * @param Origin new value of Origin
     */
    @Override
    public void setOrigin(IPlace Origin) {
        this.Origin = Origin;
    }

    /**
     * Get the value of Unit
     *
     * @return the value of Unit
     */
    @Override
    public String getUnit() {
        return Unit;
    }

    /**
     * Set the value of Unit
     *
     * @param Unit new value of Unit
     */
    @Override
    public void setUnit(String Unit) {
        this.Unit = Unit;
    }

    /**
     * Get the value of Leg
     *
     * @return the value of Leg
     */
    @Override
    public HashMap<Integer, ILocation> getLeg() {
        return Leg;
    }
        /**
     * Get the value of Leg
     *
     * @return the value of Leg
     */
     @Override
    public ILocation getLeg(int Index) {
        return Leg.get(Index);
    }
    /**
     * Set the value of Leg
     *
     * @param Leg new value of Leg
     */
    @Override
    public void setLeg(HashMap<Integer, ILocation> Leg) {
        this.Leg = Leg;
    }
    /**
     * Set the value of Leg
     *
     * @param Leg new value of Leg
     */
    @Override
    public void setLeg(int Index , ILocation locate) {
        this.Leg.get(Index).setLat(locate.getLat());
         this.Leg.get(Index).setLng(locate.getLng());
    }
    /**
     * Get the value of Distance
     *
     * @return the value of Distance
     */
    @Override
    public float getDistance() {
        return Distance;
    }

    /**
     * Set the value of Distance
     *
     * @param Distance new value of Distance
     */
    @Override
    public void setDistance(float Distance) {
        this.Distance = Distance;
    }

}
